// This is where project configuration and plugin options are located.
// Learn more: https://gridsome.org/docs/config

// Changes here require a server restart.
// To restart press CTRL + C in terminal and run `gridsome develop`
function basename(str)
{
   var base = new String(str).substring(str.lastIndexOf('/') + 1);
    if(base.lastIndexOf(".") != -1)
        base = base.substring(0, base.lastIndexOf("."));
   return base;
}
module.exports = {
    siteName: '北京凯控',
    pathPrefix: '',
    odooUrl: 'https://www.kaikong.cn',
    siteUrl: 'https://s.kaikong.cn',
    plugins: [
        {
            use: '@gridsome/source-graphql',
            options: {
                url: 'https://www.kaikong.cn/client/gql',
                fieldName: 'KuERP',
                typeName: 'KuERP',
                refetchInterval: 10,
                headers: {
                    'content-type': 'application/graphql',
                },
            },
        },
        // {
        //     use: 'gridsome-plugin-flexsearch',
        //     options: {
        //         collections: [
        //             {
        //                 typeName: 'KuERP',
        //                 indexName: 'KuERP',
        //                 fields: ['name', 'content', 'title', 'handle', 'description']
        //             },
        //         ],
        //         searchFields: ['name', 'content', 'title'],
        //         chunk: 1000,
        //         autoFetch: ['/search', '/collections']
        //     },
        // },
        {
            use: '@gridsome/plugin-sitemap',
            options: {
                cacheTime: 600000, // default
                exclude: ['/exclude-me'],
                config: {
                    '/product/*': {
                        changefreq: 'weekly',
                        priority: 0.5
                    },
                    '/content/*': {
                        changefreq: 'weekly',
                        priority: 0.5
                    },
                    '/service/*': {
                        changefreq: 'weekly',
                        priority: 0.5
                    },
                    '/soft/*': {
                        changefreq: 'weekly',
                        priority: 0.5
                    },
                    '/about': {
                        changefreq: 'monthly',
                        priority: 0.7
                    }
                }
            }
        },
        // {
        //     use: '@noxify/gridsome-plugin-remote-image',
        //     options: {
        //         'typeName': 'Entry',
        //         'sourceField': 'remoteImage',
        //         'targetField': 'imageDownloaded',
        //         'targetPath': './src/assets/remoteImages'
        //     }
        // },
        // {
        //     use: '@noxify/gridsome-plugin-remote-image',
        //     options: {
        //         'typeName': 'Entry',
        //         'sourceField': 'remoteImages',
        //         'targetField': 'imagesDownloaded',
        //         'targetPath': './src/assets/remoteImages'
        //     }
        // }
        {
    use: 'gridsome-plugin-svg',
    options: {
    // default options below
    goesBothWays: false,
    svgo: [
      {
        removeTitle: false
      },
      {
        prefixIds: {
          prefix: (_, {path}) => basename(path, '.svg'),
          delim: '-',
        },
      },
      {
        removeDesc: false
      },
      {
        removeViewBox: false,
      },
      {
        sortAttrs: true,
      }
      ],
    }
  }
    ],
}
